package cn.kgc.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import java.io.Serializable;
import java.util.Date;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "chat_msg")
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@SuppressWarnings("all")
public class ChatMsg extends Model<ChatMsg> implements Serializable {

    @TableId(type = IdType.ASSIGN_ID)
    private String id;


    /**
     * 发送者的用户id
     */
    @TableField(value = "sender_id")
    private String senderId;


    /**
     * 接受者的用户id
     */
    @TableField(value = "receiver_id")
    private String receiverId;


    /**
     * 消息接受者的类型，是HR还是求职者，目的为了让前端不同页面接受判断并且处理显示
     */
    @TableField(value = "receiver_type")
    private Integer receiverType;


    /**
     * 聊天内容
     */
    @TableField(value = "msg")
    private String msg;


    /**
     * 消息类型，有文字类
     */
    @TableField(value = "msg_type")
    private Integer msgType;


    /**
     * 消息的聊天时间，既是发送者的发送时间、又是接受者的接受时间
     */
    @TableField(value = "chat_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date chatTime; //消息的聊天时间，既是发送者的发送时间、又是接受者的接受时间


    /**
     * 用于历史展示,超过1分钟,则显示聊天时间
     */
    @TableField(value = "show_msg_date_time_flag")
    private Integer showMsgDateTimeFlag;


    /**
     * 视频地址
     */
    @TableField(value = "video_path")
    private String videoPath;


    /**
     * 视频宽度
     */
    @TableField(value = "video_width")
    private Integer videoWidth;


    /**
     * 视频高度
     */
    @TableField(value = "video_height")
    private Integer videoHeight;


    /**
     * 视频时间
     */
    @TableField(value = "video_times")
    private Integer videoTimes;


    /**
     * 语音地址
     */
    @TableField(value = "voice_path")
    private String voicePath;


    /**
     * 语音时长
     */
    @TableField(value = "speak_voice_duration")
    private Integer speakVoiceDuration;


    /**
     * 1: 已读，0:未读
     */
    @TableField(value = "is_read")
    private Short isRead;


    /**
     * 简历id
     */
    @TableField(value = "resume_user_id")
    private String resumeUserId;


    /**
     * 用户名称
     */
    @TableField(value = "resume_name")
    private String resumeName;


    /**
     * 候选人职位
     */
    @TableField(value = "resume_position")
    private String resumePosition;

    /**
     * 当前接收者是否在线
     */
    @TableField(exist = false)
    private boolean isReceiverOnline;

}
